from AssetManageDao import ElectronicAssetModel,UserModel,AssetManageDao
from sys import flags, maxsize

class AssetManageService:
    @staticmethod
    def get_user_device(args):
        return AssetManageDao.filter_user_devices(args).all()

    @staticmethod
    def get_user_device_page(args, withCount: bool = False, pageIndex: int = 1, pageSize: int = maxsize):
        count = [0, AssetManageDao.filter_user_devices(args).count()][withCount]
        result = AssetManageDao.filter_user_devices_page(args, pageIndex, pageSize).all()
        return count, result
